using UnityEngine;

[ExecuteInEditMode]
public class EditChaMode : MonoBehaviour
{
	public DataController alldata;

	public bool isrunflag;

	public int challmode;

	public int modetype;

	public GameChaInfo tempgcinfo;

	private void Update()
	{
		if (isrunflag)
		{
			isrunflag = false;
			alldata = GameObject.Find("DataController").GetComponent<DataController>();
			readinfo();
		}
	}

	public void readinfo()
	{
		tempgcinfo = new GameChaInfo();
		tempgcinfo.start_pr = new PosRot();
		tempgcinfo.island = -1;
		tempgcinfo.jidi1id = -1;
		tempgcinfo.jidi2id = -1;
		foreach (Transform item in base.transform)
		{
			switch (item.name)
			{
			case "00_player":
				tempgcinfo.start_pr.pos = item.position;
				tempgcinfo.start_pr.rot = item.eulerAngles;
				break;
			case "center":
				tempgcinfo.center = item.position;
				break;
			case "AI_JD_1":
				tempgcinfo.jidi2id = 0;
				break;
			case "AI_JD_2":
				tempgcinfo.jidi2id = 1;
				break;
			case "Fri_JD_1":
				tempgcinfo.jidi1id = 2;
				break;
			case "Fri_JD_2":
				tempgcinfo.jidi1id = 3;
				break;
			case "AI_JD_3":
				tempgcinfo.jidi2id = 4;
				break;
			case "AI_JD_4":
				tempgcinfo.jidi2id = 5;
				break;
			case "bigisland_single":
				tempgcinfo.island = 0;
				break;
			case "qundao_single":
				tempgcinfo.island = 1;
				break;
			case "island_double":
				tempgcinfo.island = 2;
				break;
			}
		}
		switch (challmode)
		{
		case 0:
			alldata.tdmdata[modetype].gcinfo = tempgcinfo;
			break;
		case 1:
			alldata.surdata[modetype].gcinfo = tempgcinfo;
			break;
		case 2:
			alldata.dtbdata[modetype].gcinfo = tempgcinfo;
			break;
		case 3:
			alldata.ffadata[modetype].gcinfo = tempgcinfo;
			break;
		}
	}
}
